package com.vincent.guava;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.google.common.base.Charsets;
import com.google.common.io.ByteStreams;
import com.google.common.io.CharStreams;

public class StreamsTester {
	public String charStreamsTester(){
		try (InputStreamReader inputStreamReader = new InputStreamReader(System.in)){
			return CharStreams.toString(inputStreamReader);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
	
	public String byteStreamsTester(){
		try (InputStream in = System.in;){
			return new String(ByteStreams.toByteArray(in),Charsets.UTF_8);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
}
